package cn.exrick.common.task;

import cn.exrick.service.MemberService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author wm
 * @date 2019/1/7
 */
@Component
public class UpdateMemberVipJob {

    final static Logger log = LoggerFactory.getLogger(UpdateMemberVipJob.class);

    @Autowired
    private MemberService memberService;

    @Scheduled(cron="0 0 0 * * ?")
    public void updateMemberVip(){
        Date date = new Date();
        memberService.updateExpiredMemberVip(date);
        log.info("定时检查会员过期时间成功");
    }

}
